home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / utils / file / logiso.000 / logiso / RCS / iso_fs.h,v < prev    next >
Encoding:
Text File  |  1995-03-24  |  11.7 KB  |  440 lines

  1. head    1.7;
  2. access;
  3. symbols
  4.     VER_0_3:1.7
  5.     VER_0_2:1.6;
  6. locks; strict;
  7. comment    @ * @;
  8.  
  9.  
  10. 1.7
  11. date    95.03.24.11.44.17;    author coulter;    state Exp;
  12. branches;
  13. next    1.6;
  14.  
  15. 1.6
  16. date    95.03.10.02.43.06;    author coulter;    state Exp;
  17. branches;
  18. next    1.5;
  19.  
  20. 1.5
  21. date    95.02.19.17.15.09;    author coulter;    state Exp;
  22. branches;
  23. next    1.4;
  24.  
  25. 1.4
  26. date    95.02.14.21.39.21;    author coulter;    state Exp;
  27. branches;
  28. next    1.3;
  29.  
  30. 1.3
  31. date    95.02.14.20.22.40;    author coulter;    state Exp;
  32. branches;
  33. next    1.2;
  34.  
  35. 1.2
  36. date    95.02.13.20.56.00;    author coulter;    state Exp;
  37. branches;
  38. next    1.1;
  39.  
  40. 1.1
  41. date    95.02.11.13.01.27;    author coulter;    state Exp;
  42. branches;
  43. next    ;
  44.  
  45.  
  46. desc
  47. @isofs main declaration file.  Will add ioctl command constants here.
  48. @
  49.  
  50.  
  51. 1.7
  52. log
  53. @Checkin version for 0.3 distribution.
  54. @
  55. text
  56. @
  57. #ifndef _ISOFS_FS_H
  58. #define _ISOFS_FS_H
  59.  
  60. #include <linux/fs.h>
  61. #include <linux/ioctl.h>
  62. #include <linux/types.h>
  63. /*
  64.  * The isofs filesystem constants/structures
  65.  */
  66.  
  67. /* This part borrowed from the bsd386 isofs */
  68. #define ISODCL(from, to) (to - from + 1)
  69.  
  70. struct iso_volume_descriptor {
  71.     char type[ISODCL(1,1)]; /* 711 */
  72.     char id[ISODCL(2,6)];
  73.     char version[ISODCL(7,7)];
  74.     char data[ISODCL(8,2048)];
  75. };
  76.  
  77. /* volume descriptor types */
  78. #define ISO_VD_PRIMARY 1
  79. #define ISO_VD_END 255
  80.  
  81. #define ISO_STANDARD_ID "CD001"
  82.  
  83. struct iso_primary_descriptor {
  84.     char type            [ISODCL (  1,   1)]; /* 711 */
  85.     char id                [ISODCL (  2,   6)];
  86.     char version            [ISODCL (  7,   7)]; /* 711 */
  87.     char unused1            [ISODCL (  8,   8)];
  88.     char system_id            [ISODCL (  9,  40)]; /* achars */
  89.     char volume_id            [ISODCL ( 41,  72)]; /* dchars */
  90.     char unused2            [ISODCL ( 73,  80)];
  91.     char volume_space_size        [ISODCL ( 81,  88)]; /* 733 */
  92.     char unused3            [ISODCL ( 89, 120)];
  93.     char volume_set_size        [ISODCL (121, 124)]; /* 723 */
  94.     char volume_sequence_number    [ISODCL (125, 128)]; /* 723 */
  95.     char logical_block_size        [ISODCL (129, 132)]; /* 723 */
  96.     char path_table_size        [ISODCL (133, 140)]; /* 733 */
  97.     char type_l_path_table        [ISODCL (141, 144)]; /* 731 */
  98.     char opt_type_l_path_table    [ISODCL (145, 148)]; /* 731 */
  99.     char type_m_path_table        [ISODCL (149, 152)]; /* 732 */
  100.     char opt_type_m_path_table    [ISODCL (153, 156)]; /* 732 */
  101.     char root_directory_record    [ISODCL (157, 190)]; /* 9.1 */
  102.     char volume_set_id        [ISODCL (191, 318)]; /* dchars */
  103.     char publisher_id        [ISODCL (319, 446)]; /* achars */
  104.     char preparer_id        [ISODCL (447, 574)]; /* achars */
  105.     char application_id        [ISODCL (575, 702)]; /* achars */
  106.     char copyright_file_id        [ISODCL (703, 739)]; /* 7.5 dchars */
  107.     char abstract_file_id        [ISODCL (740, 776)]; /* 7.5 dchars */
  108.     char bibliographic_file_id    [ISODCL (777, 813)]; /* 7.5 dchars */
  109.     char creation_date        [ISODCL (814, 830)]; /* 8.4.26.1 */
  110.     char modification_date        [ISODCL (831, 847)]; /* 8.4.26.1 */
  111.     char expiration_date        [ISODCL (848, 864)]; /* 8.4.26.1 */
  112.     char effective_date        [ISODCL (865, 881)]; /* 8.4.26.1 */
  113.     char file_structure_version    [ISODCL (882, 882)]; /* 711 */
  114.     char unused4            [ISODCL (883, 883)];
  115.     char application_data        [ISODCL (884, 1395)];
  116.     char unused5            [ISODCL (1396, 2048)];
  117. };
  118.  
  119.  
  120. #define HS_STANDARD_ID "CDROM"
  121.  
  122. struct  hs_volume_descriptor {
  123.     char foo            [ISODCL (  1,   8)]; /* 733 */
  124.     char type            [ISODCL (  9,   9)]; /* 711 */
  125.     char id                [ISODCL ( 10,  14)];
  126.     char version            [ISODCL ( 15,  15)]; /* 711 */
  127.     char data[ISODCL(16,2048)];
  128. };
  129.  
  130.  
  131. struct hs_primary_descriptor {
  132.     char foo            [ISODCL (  1,   8)]; /* 733 */
  133.     char type            [ISODCL (  9,   9)]; /* 711 */
  134.     char id                [ISODCL ( 10,  14)];
  135.     char version            [ISODCL ( 15,  15)]; /* 711 */
  136.     char unused1            [ISODCL ( 16,  16)]; /* 711 */
  137.     char system_id            [ISODCL ( 17,  48)]; /* achars */
  138.     char volume_id            [ISODCL ( 49,  80)]; /* dchars */
  139.     char unused2            [ISODCL ( 81,  88)]; /* 733 */
  140.     char volume_space_size        [ISODCL ( 89,  96)]; /* 733 */
  141.     char unused3            [ISODCL ( 97, 128)]; /* 733 */
  142.     char volume_set_size        [ISODCL (129, 132)]; /* 723 */
  143.     char volume_sequence_number    [ISODCL (133, 136)]; /* 723 */
  144.     char logical_block_size        [ISODCL (137, 140)]; /* 723 */
  145.     char path_table_size        [ISODCL (141, 148)]; /* 733 */
  146.     char type_l_path_table        [ISODCL (149, 152)]; /* 731 */
  147.     char unused4            [ISODCL (153, 180)]; /* 733 */
  148.     char root_directory_record    [ISODCL (181, 214)]; /* 9.1 */
  149. };
  150.  
  151. /* We use this to help us look up the parent inode numbers. */
  152.  
  153. struct iso_path_table{
  154.     unsigned char  name_len[2];    /* 721 */
  155.     char extent[4];        /* 731 */
  156.     char  parent[2];    /* 721 */
  157.     char name[0];
  158. };
  159.  
  160. /* high sierra is identical to iso, except that the date is only 6 bytes, and
  161.    there is an extra reserved byte after the flags */
  162.  
  163. struct iso_directory_record {
  164.     char length            [ISODCL (1, 1)]; /* 711 */
  165.     char ext_attr_length        [ISODCL (2, 2)]; /* 711 */
  166.     char extent            [ISODCL (3, 10)]; /* 733 */
  167.     char size            [ISODCL (11, 18)]; /* 733 */
  168.     char date            [ISODCL (19, 25)]; /* 7 by 711 */
  169.     char flags            [ISODCL (26, 26)];
  170.     char file_unit_size        [ISODCL (27, 27)]; /* 711 */
  171.     char interleave            [ISODCL (28, 28)]; /* 711 */
  172.     char volume_sequence_number    [ISODCL (29, 32)]; /* 723 */
  173.     unsigned char name_len        [ISODCL (33, 33)]; /* 711 */
  174.     char name            [0];
  175. };
  176.  
  177. #define ISOFS_BLOCK_BITS 11
  178. #define ISOFS_BLOCK_SIZE 2048
  179.  
  180. #define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize)
  181. #define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits)
  182.  
  183. #if 0
  184. #ifdef ISOFS_FIXED_BLOCKSIZE
  185. /* We use these until the buffer cache supports 2048 */
  186. #define ISOFS_BUFFER_BITS 10
  187. #define ISOFS_BUFFER_SIZE 1024
  188.  
  189. #define ISOFS_BLOCK_NUMBER(X) (X<<1)
  190. #else
  191. #define ISOFS_BUFFER_BITS 11
  192. #define ISOFS_BUFFER_SIZE 2048
  193.  
  194. #define ISOFS_BLOCK_NUMBER(X) (X)
  195. #endif
  196. #endif
  197.  
  198. #define ISOFS_SUPER_MAGIC 0x9660
  199. #define ISOFS_FILE_UNKNOWN 0
  200. #define ISOFS_FILE_TEXT 1
  201. #define ISOFS_FILE_BINARY 2
  202. #define ISOFS_FILE_TEXT_M 3
  203.  
  204. #ifdef __KERNEL__
  205. extern int isonum_711(char *);
  206. extern int isonum_712(char *);
  207. extern int isonum_721(char *);
  208. extern int isonum_722(char *);
  209. extern int isonum_723(char *);
  210. extern int isonum_731(char *);
  211. extern int isonum_732(char *);
  212. extern int isonum_733(char *);
  213. extern int iso_date(char *, int);
  214.  
  215. extern int parse_rock_ridge_inode(struct iso_directory_record *, struct inode *);
  216. extern int get_rock_ridge_filename(struct iso_directory_record *, char ** name, int * len, struct inode *);
  217.  
  218. extern char * get_rock_ridge_symlink(struct inode *);
  219. extern int find_rock_ridge_relocation(struct iso_directory_record *, struct inode *);
  220.  
  221. /* The stuff that follows may be totally unneeded. I have not checked to see 
  222.  which prototypes we are still using.  */
  223.  
  224. extern int isofs_open(struct inode * inode, struct file * filp);
  225. extern void isofs_release(struct inode * inode, struct file * filp);
  226. extern int isofs_lookup(struct inode * dir,const char * name, int len,
  227.     struct inode ** result);
  228. extern unsigned long isofs_count_free_inodes(struct super_block *sb);
  229. extern int isofs_new_block(int dev);
  230. extern int isofs_free_block(int dev, int block);
  231. extern int isofs_bmap(struct inode *,int);
  232.  
  233. extern void isofs_put_super(struct super_block *);
  234. extern struct super_block *isofs_read_super(struct super_block *,void *,int);
  235. extern void isofs_read_inode(struct inode *);
  236. extern void isofs_put_inode(struct inode *);
  237. extern void isofs_statfs(struct super_block *, struct statfs *);
  238.  
  239. extern int isofs_lseek(struct inode *, struct file *, off_t, int);
  240. extern int isofs_read(struct inode *, struct file *, char *, int);
  241. extern int isofs_lookup_grandparent(struct inode *, int);
  242.  
  243. extern struct inode_operations isofs_file_inode_operations;
  244. extern struct inode_operations isofs_dir_inode_operations;
  245. extern struct inode_operations isofs_symlink_inode_operations;
  246. extern struct inode_operations isofs_chrdev_inode_operations;
  247. extern struct inode_operations isofs_blkdev_inode_operations;
  248. extern struct inode_operations isofs_fifo_inode_operations;
  249.  
  250. /* The following macros are used to check for memory leaks. */
  251. #ifdef LEAK_CHECK
  252. #define free_s leak_check_free_s
  253. #define malloc leak_check_malloc
  254. #define bread leak_check_bread
  255. #define brelse leak_check_brelse
  256. extern void * leak_check_malloc(unsigned int size);
  257. extern void leak_check_free_s(void * obj, int size);
  258. extern struct buffer_head * leak_check_bread(int dev, int block, int size);
  259. extern void leak_check_brelse(struct buffer_head * bh);
  260. #endif /* LEAK_CHECK */
  261.  
  262. /*
  263.  * iso_ioctl implements the ioctl commands declared below.
  264.  */
  265.  
  266. extern int     iso_ioctl (struct inode *, 
  267.                    struct file *, 
  268.                    unsigned int,
  269.                    unsigned long);
  270. extern     int     log_generic_mmap(struct inode * inode,
  271.                   struct file * file, 
  272.                   struct vm_area_struct * vm_area);
  273.  
  274. extern void     iso_log_add(unsigned long inode, dev_t i_dev, int operation);
  275. extern int     iso_log_read(struct inode* inode, void* user_buf_p);
  276.  
  277. #endif /* __KERNEL__ */
  278.  
  279. struct iso_log_entry {
  280.     unsigned long    inode;
  281.     dev_t        device;
  282.     int        operation; /* an ISO_LOG_OP_* define */
  283. };
  284.  
  285.  
  286. /* Conceptually the log_entry array is the size indicated by nbr_entries.
  287. */
  288.  
  289. struct iso_log_info {
  290.     int    version;
  291.     int    buf_format;
  292.     int    size;    /* iso_log_info plus buffer for log entries */
  293.     dev_t    device;
  294.     int    overflow_count;
  295.     int    nbr_entries;  /* nbr of log entries used in buffer */
  296.     struct iso_log_entry log_entry[1];
  297. };
  298.  
  299. /****************************************************************************
  300.    isofs logging defines:
  301.       ISO_IOC_*        ioctl commands
  302.       ISO_LOG_BUF_FORMAT1    the one and only buffer format
  303.                   defined.  Someday there may be a 
  304.                  command to request different logging with
  305.                  different buffer formats.
  306.     ISO_LOG_MALLOC_LIMIT    largest region obtainable from kmalloc()
  307.     ISO_LOG_NBR_LOG_BUFS    The number of ISO_LOG_MALLOC_LIMIT size buffers
  308.                 to allocate to hold log information.
  309.     ISO_LOG_OP_*        Operation codes which appear in the log.
  310.     ISO_LOG_SIZE        Size of memory passed to user.  iso_log_info
  311.                 plus space for all the buffers.
  312.     ISO_LOG_VERSION     1.  If you see a different number, the 
  313.                 interface has changed.
  314.  
  315. ****************************************************************************/
  316.  
  317. /* Define ISO_LOG_MALLOC_LIMIT  for use in another define */
  318. #define ISO_LOG_MALLOC_LIMIT        4096
  319.  
  320. #define ISO_IOC_GETLOGSIZE              _IO('i', 1)
  321. #define ISO_IOC_STOPLOG                 _IO('i', 2)
  322. #define ISO_IOC_READLOG            _IOR('i', 3, void*)
  323. #define ISO_LOG_BUF_FORMAT1        1
  324. #define ISO_LOG_OP_generic_mmap        1
  325. #define ISO_LOG_OP_isofs_bmap        2
  326. #define ISO_LOG_OP_isofs_file_read    3
  327. #define ISO_LOG_OP_isofs_readdir    4
  328. #define ISO_LOG_OP_isofs_lookup        5
  329. #define ISO_LOG_ENTRIES_PER_BUF     (  ISO_LOG_MALLOC_LIMIT     \
  330.                       / sizeof(struct iso_log_entry))
  331. #define ISO_LOG_NBR_LOG_BUFS        10
  332. #define ISO_LOG_SIZE            (   sizeof(struct iso_log_info) \
  333.                       + (  ISO_LOG_NBR_LOG_BUFS     \
  334.                          * ISO_LOG_MALLOC_LIMIT))
  335.  
  336. #define ISO_LOG_VERSION            2
  337.  
  338. /*
  339.  * Operation codes which appear in the log.
  340.  */
  341.  
  342.  
  343. #endif /* _ISOFS_FS_H */
  344. @
  345.  
  346.  
  347. 1.6
  348. log
  349. @Checkin files modified to make version 0.2
  350. @
  351. text
  352. @@
  353.  
  354.  
  355. 1.5
  356. log
  357. @Added code to map generic_mmap.  Commented out for now.
  358. @
  359. text
  360. @d5 1
  361. d219 2
  362. a220 2
  363. extern void     iso_log_add(unsigned long inode, int operation);
  364. extern int     iso_log_read(void* user_buf_p);
  365. d226 1
  366. d238 1
  367. d281 1
  368. a281 1
  369. #define ISO_LOG_VERSION            1
  370. @
  371.  
  372.  
  373. 1.4
  374. log
  375. @Checkpoint files to send to isofs owners.
  376. @
  377. text
  378. @d214 3
  379. @
  380.  
  381.  
  382. 1.3
  383. log
  384. @Checkpoint working dynamic log version.
  385. @
  386. text
  387. @d259 3
  388. a261 3
  389. #define ISO_IOC_GETLOGSIZE              _IO('s', 1)
  390. #define ISO_IOC_STOPLOG                 _IO('s', 2)
  391. #define ISO_IOC_READLOG            _IOR('r', 1, void*)
  392. @
  393.  
  394.  
  395. 1.2
  396. log
  397. @Checkin working version.  Try to make it dynamic now.
  398. @
  399. text
  400. @a219 16
  401. /*
  402.  * ioctl commands
  403.  */
  404.  
  405. #define ISO_IOC_GETLOGSIZE               _IO('s', 1)
  406. #define ISO_IOC_READLOG             _IOR('r', 1, void*)
  407.  
  408. #define ISO_LOG_VERSION            1
  409. #define ISO_LOG_MAX_ENTRIES        5000
  410.  
  411. #define ISO_LOG_OP_generic_mmap            1
  412. #define ISO_LOG_OP_isofs_bmap            2
  413. #define ISO_LOG_OP_isofs_file_read        3
  414. #define ISO_LOG_OP_isofs_readdir        4
  415. #define ISO_LOG_OP_isofs_lookup            5
  416.  
  417. d225 4
  418. d231 1
  419. d235 1
  420. a235 1
  421.     struct iso_log_entry log_entry[ISO_LOG_MAX_ENTRIES];
  422. d237 44
  423. @
  424.  
  425.  
  426. 1.1
  427. log
  428. @Initial revision
  429. @
  430. text
  431. @d5 1
  432. d206 12
  433. d220 15
  434. a234 1
  435. #endif
  436. d236 4
  437. d241 7
  438. d249 1
  439. @
  440.